/*
 * zzllrr Mather
 * zzllrr@gmail
 * Released under MIT License
 */

wiki['Formula/Polynomial/Identity']=Kx(
detail('多项式恒等式（因式分解公式）',Table([ZLR('名称 记法 = 结果 性质')],[
	

	['2次多项式','x^2+(a+b)x+ab','=','(x+a)(x+b)',''],
	['2次多项式','cdx^2+(ad+bc)x+ab','=','(cx+a)(dx+b)'],
    ['完全平方',khrA(['a^2+2ab+b^2','a^2-2ab+b^2']),hrA(['=','=']),khrA(['(a+b)^2','(a-b)^2'])],
	['平方差','a^2-b^2','=','(a+b)(a-b)'],
	['完全立方',khrA(['a^3+3a^2b+3ab^2+b^3','a^3+3ab(a+b)+b^3']),hrA(['=','=']),khrA(['(a+b)^3'])],
    ['完全立方',khrA(['a^3-3a^2b+3ab^2-b^3','a^3-3ab(a-b)-b^3']),hrA(['=','=']),khrA(['(a-b)^3'])],
    ['立方和','a^3+b^3','=','(a+b)(a^2-ab+b^2)'],
    ['立方差','a^3-b^3','=','(a-b)(a^2+ab+b^2)'],
	['奇数方和','a^n+b^n','=','(a+b)\\\\\\(a^{n-1}-a^{n-2}b+a^{n-3}b^2-⋯-ab^{n-2}+b^{n-1} \\\\\\) '],
	['奇数方差','a^n-b^n','=','(a-b)\\\\\\(a^{n-1}+a^{n-2}b+a^{n-3}b^2+⋯+ab^{n-2}+b^{n-1} \\\\\\) '],
	[kxA(['偶数方差','n=2^kd','d是奇数']),'a^n-b^n','=',khrA(['(a+b)(a-b)\\\\\\(a^{n-2}+a^{n-4}b^2+a^{n-6}b^4+⋯+a^2b^{n-4}+b^{n-2} \\\\\\) ',
        kxA(['(a+b)(a-b)',
        '(a^{d-1}-a^{d-2}b+a^{d-3}b^2-⋯-ab^{d-2}+b^{d-1})',
		'(a^{d-1}+a^{d-2}b+a^{d-3}b^2+⋯+ab^{d-2}+b^{d-1})',
		'(a^{2d}+b^{2d})(a^{4d}+b^{4d})⋯(a^{2^{k-1}d}+b^{2^{k-1}d})'])
		])
		],
	[kxA(['偶齐次项和','n=2^kd-2','k>1','d是奇数']),'a^n+a^{n-2}b^2+a^{n-4}b^4\\\\+⋯+a^2b^{n-2}+b^n','=',
		kxA(['(a^{d-1}-a^{d-2}b+a^{d-3}b^2-⋯-ab^{d-2}+b^{d-1})',
			'(a^{d-1}+a^{d-2}b+a^{d-3}b^2+⋯+ab^{d-2}+b^{d-1})',
			'(a^{2d}+b^{2d})(a^{4d}+b^{4d})⋯(a^{2^{k-1}d}+b^{2^{k-1}d})'
		])
		],
	['4次齐次项和','a^4+a^2b^2+b^4','=',
		'(a^2+ab+b^2)(a^2-ab+b^2)'
		],

	['6次4项式','a^4+(2-c^2)a^2b^2+b^4','=',
		kbrA(['(a^2+b^2)^2-a^2b^2c^2','(a^2+b^2+abc)(a^2+b^2-abc)'])
	],

	['4次2项式','4a^4+1','=',
		kbrA(['(2a^2+1)^2-4a^2','(2a^2+2a+1)(2a^2-2a+1)','(2a(a+1)+1)(2a(a-1)+1)'])
		],

	['4次2项式','4a^4+b^4','=',
		kbrA(['(2a^2+b^2)^2-4a^2b^2','(2a^2+b^2+2ab)(2a^2+b^2-2ab)','(2a(a+b)+b^2)(2a(a-b)+b^2)'])
	],

	['4次2项式','a^4+4','=',
		kbrA(['(a^2+2)^2-4a^2','(a^2+2a+2)(a^2-2a+2)','((a+1)^2+1)((a-1)^2+1)','(a^2+2(1+a))(a^2+2(1-a))'])
	],


	['4次2项式','a^4+4b^4','=',
		kbrA(['(a^2+2b^2)^2-4a^2b^2','(a^2+2b^2+2ab)(a^2+2b^2-2ab)','(a^2+2b(b+a))(a^2+2b(b-a))'])
	],

	['8次2项式','4a^4b^4+1','=',
		kbrA(['(2a^2b^2+1)^2-4a^2b^2','(2a^2b^2+2ab+1)(2a^2b^2-2ab+1)','(2ab(ab+1)+1)(2ab(ab-1)+1)'])
		],

	['8次2项式','4a^4b^4+c^4','=',
		kbrA(['(2a^2b^2+c^2)^2-4a^2b^2c^2','(2a^2b^2+c^2+2abc)(2a^2b^2+c^2-2abc)','(2ab(ab+c)+c^2)(2ab(ab-c)+c^2)'])
		],

	['8次2项式','a^4+4b^4c^4','=',
		kbrA(['(a^2+2b^2c^2)^2-4a^2b^2c^2','(a^2+2b^2c^2+2abc)(a^2+2b^2c^2-2abc)','(a^2+2bc(bc+a))(a^2+2bc(bc-a))'])
		],


    ['2次齐次项和','a^2+ab+b^2','=',
		kbrA(['(a+b)^2-ab','(a+b+√{ab})(a+b-√{ab})'])
		],
	['3项和平方','a^2+b^2+c^2\\\\+2(ab+ac+bc)','=',
		'(a+b+c)^2'
		],
	['3项和立方',kxA(['a^3+b^3+c^3+','3(a^2b+a^2c','+b^2a+b^2c','+c^2a+c^2b)','+6abc']),'=',
		'(a+b+c)^3'
		],
	['n项和平方',sum('i',1,'n','a_i^2','','')+'+2'+sum('','i≤j','','a_ia_j','',''),'=',
		lrp('',sum('i',1,'n','a_i','',''),'','')+'^2'
		],
	["欧拉4平方恒等式\nEuler's_four-square_identity",
		khrA(['(a^2+b^2+c^2+d^2)(w^2+x^2+y^2+z^2)'
		]),

		'=',
		hrA([
			'每一项都按wxyz排序',
			kbrA(['(aw+bx+cy+dz)^2','+(bw-ax+dy-cz)^2','+(cw-dx-ay+bz)^2','+(dw+cx-by-az)^2']),
			'每一项都按abcd排序',
			kbrA(['(aw+bx+cy+dz)^2','+(-ax+bw-cz+dy)^2','+(-ay+bz+cw-dx)^2','+(-az-by+cx+dw)^2']),
			'每一项首项符号为正',
			kbrA(['(aw+bx+cy+dz)^2','+(ax-bw+cz-dy)^2','+(ay-bz-cw+dx)^2','+(az+by-cx-dw)^2']),
	
			kbrA(['用四元数模来证明',
			'|a+bi+cj+dk||w+xi+yj+zk|',
			'=|(a+bi+cj+dk)(w+xi+yi+zk)|',
			'=|(aw-bx-cy-dz)+(ax+bw+cz-dy)i',
			'+(ay-bz+cw+dx)j+(az+by-cx+dw)k|'
			]),
			kbrA(['(aw-bx-cy-dz)^2','+(ax+bw+cz-dy)^2','+(ay-bz+cw+dx)^2','+(az+by-cx+dw)^2']),
			'x换成-x',
			kbrA(['(aw+bx-cy-dz)^2','+(ax-bw-cz+dy)^2','+(ay-bz+cw-dx)^2','+(az+by+cx+dw)^2']),
			gM2("Pfister's identity"),
			kbrA(['(aw-bx-cA-dB)^2','+(ax+bw+cB-dA)^2','+(ay-bz+cw-dx)^2','+(az+by+cx+dw)^2']),
			'其中'+ksc(piece([
				'A=\\dfrac{w^2y+2wxz-x^2y}{w^2+x^2}',
					'=\\dfrac{(w^2-x^2)y+(2wx)z}{w^2+x^2}',
				'B=\\dfrac{w^2z-2wxy-x^2z}{w^2+x^2}',
					'=\\dfrac{(w^2-x^2)z-(2wx)y}{w^2+x^2}',
				'A^2+B^2=y^2+z^2'
			])),
			'类似地，有8平方和、16平方和恒等式',
	
			])
	],
	
	['平方方和与和的平方之和','a^{2}+b^{2}+(a+b)^{2}','=','2(a^{2}+ab+b^{2})'],
	['平方方和与差的平方之和','a^{4}+b^{4}+(a-b)^{2}','=','2(a^{2}-ab+b^{2})'],

	['四次方和与和的四次方之和','a^{4}+b^{4}+(a+b)^{4}','=','2(a^{2}+ab+b^{2})^{2}'],
	['四次方和与差的四次方之和','a^{4}+b^{4}+(a-b)^{4}','=','2(a^{2}-ab+b^{2})^{2}'],

/*
1 2 1
1   1

1 4 6 4 1
1       1

a^4 a^3 a^2
	1   1     1
		1     1   1
		
1   2   3   2    1

1 8 28 56 70

1 4 14 28 35



1   k   1
	k   k^2    k
		1     k   1
		
1   2k  2+k^2   2k    1
   2k(1   2k   2+k^2  2k    1)
	 (2+k^2)(1   2k  2+k^2  2k    1)
               2k(1   2k  2+k^2  2k     1)
					  1   2k  2+k^2   2k    1

1  4k   2(2+3k^2)    2(2k+2k(2+k^2))=4k(3+k^2)

2(1+2k*2k)+(2+k^2)^2

1   2   3   2    1
	2   4   6    4    2
		3   6    9    6    3
			2    4   6    4    2
			     1   2   3   2    1
1 4 10 16 19 16 10 4 1

*/


	['八次方和与和的八次方之和','a^{8}+b^{8}+(a+b)^{8}','=','2(a^{2}+ab+b^{2})^{4}'],
	['八次方和与差的八次方之和','a^{8}+b^{8}+(a-b)^{8}','=','2(a^{2}-ab+b^{2})^{4}'],


	['2^k次方和与和的2^k次方之和','a^{2^k}+b^{2^k}+(a+b)^{2^k}','=','2(a^{2}+ab+b^{2})^{2^{k-1}}'],
	['2^k次方和与差的2^k次方之和','a^{2^k}+b^{2^k}+(a-b)^{2^k}','=','2(a^{2}-ab+b^{2})^{2^{k-1}}'],

	['平方和乘积','(a^2+b^2)(c^2+d^2)','=', kbrA([piece(['(ac-bd)^2+(ad+bc)^2','(ac+bd)^2+(ad-bc)^2']), kxf(gM('Brahmagupta–Fibonacci Identity')),
		kxf('Brahmagupta–Fibonacci Identity'),
		'用复数模来证明|a+bi||c+di|=|(a+bi)(c+di)|'])],

	['平方和乘积扩展','(a^2+nb^2)(c^2+nd^2)','=',piece(['(ac-nbd)^2+n(ad+bc)^2','(ac+nbd)^2+n(ad-bc)^2'])+kbr+kxf(gM2('Brahmagupta Identity'))],


],'wiki').replace(/\n/g,br))+
detail('基本对称多项式',Table([ZLR('名称 记法 结果 性质')],[
	

	['2项',piece(['σ_1=a+b','σ_2=ab']),'',''],
	['2项幂和',khrA(['s_k=a^k+b^k',
		's_k=σ_1s_{k-1}-σ_2s_{k-2}']),kbrA([
			'\\cfrac{s_k}k='+sum('i',0,zp('k/2','⌊⌋'),
				kfrac(['(-1)^i(k-i-1)!','i!(k-2i)!'])+'σ_1^{k-2i}σ_2^i',0,''),
			's_1=σ_1',
			's_2=σ_1^2-2σ_2',
			's_3=σ_1^3-3σ_1σ_2',
			's_4=σ_1^4-4σ_1^2σ_2+2σ_2^2',
			's_5=σ_1^5-5σ_1^3σ_2+5σ_1σ_2^2',
			's_6=σ_1^6-6σ_1^4σ_2+9σ_1^2σ_2^2-2σ_2^3',
			's_7=σ_1^7-7σ_1^5σ_2+14σ_1^3σ_2^2-7σ_1σ_2^3',
			's_8=σ_1^8-8σ_1^6σ_2+20σ_1^4σ_2^2-16σ_1^2σ_2^3+2σ_2^4',
			's_9=σ_1^9-9σ_1^7σ_2+27σ_1^5σ_2^2-30σ_1^3σ_2^3+9σ_1σ_2^4',
			's_{10}=σ_1^{10}-10σ_1^8σ_2+35σ_1^6σ_2^2-50σ_1^4σ_2^3+25σ_1^2σ_2^4-2σ_2^5',
	
		])],
	
	['3项',piece(['σ_1=a+b+c','σ_2=ab+ac+bc','σ_3=abc']),''],
	['3项幂和',khrA(['s_k=a^k+b^k+c^k',
		's_k=σ_1s_{k-1}-σ_2s_{k-2}+σ_3s_{k-3}']),kbrA([
			'\\cfrac{s_k}k='+sum('','λ_1+2λ_2+3λ_3=k','',
				kfrac(['(-1)^{k-(λ_1+λ_2+λ_3)}(λ_1+λ_2+λ_3)!','λ_1!λ_2!λ_3!'])+'σ_1^{λ_1}σ_2^{λ_2}σ_3^{λ_3}',0,''),
			's_1=σ_1',
			's_2=σ_1^2-2σ_2',
			's_3=σ_1^3-3σ_1σ_2\\\\ +3σ_3',
			's_4=σ_1^4-4σ_1^2σ_2+2σ_2^2\\\\ +4σ_1σ_3',
			's_5=σ_1^5-5σ_1^3σ_2+5σ_1σ_2^2\\\\ +5σ_1^2σ_3-5σ_2σ_3',
			's_6=σ_1^6-6σ_1^4σ_2+9σ_1^2σ_2^2-2σ_2^3\\\\ +6σ_1^3σ_3-12σ_1σ_2σ_3+3σ_3^2',
			's_7=σ_1^7-7σ_1^5σ_2+14σ_1^3σ_2^2-7σ_1σ_2^3\\\\ +7σ_1^4σ_3-21σ_1^2σ_2σ_3\\\\ +7σ_1σ_3^2+7σ_2^2σ_3',
			's_8=σ_1^8-8σ_1^6σ_2+20σ_1^4σ_2^2-16σ_1^2σ_2^3+2σ_2^4\\\\ +8σ_1^5σ_3-32σ_1^3σ_2σ_3+12σ_1^2σ_3^2\\\\ +24σ_1σ_1^2σ_3-8σ_2σ_3^2',
			's_9=σ_1^9-9σ_1^7σ_2+27σ_1^5σ_2^2-30σ_1^3σ_2^3+9σ_1σ_2^4\\\\ +9σ_1^6σ_3-45σ_1^4σ_2σ_3+54σ_1^2σ_1^2σ_3+18σ_1^3σ_3^2 \\\\ -9σ_2^3σ_3-27σ_1σ_2σ_3^2+3σ_3^2',
			's_{10}=σ_1^{10}-10σ_1^8σ_2+35σ_1^6σ_2^2-50σ_1^4σ_2^3+25σ_1^2σ_2^4-2σ_2^5\\\\ +10σ_1^7σ_3-60σ_1^5σ_2σ_3+100σ_1^3σ_2^2σ_3+25σ_1^4σ_3^2\\\\ -40σ_1σ_2^3σ_3-60σ_1^2σ_2σ_3^2+10σ_1σ_3^3+15σ_2^2σ_3^2',
	
		])],



],'wiki').replace(/\n/g,br))
)+refer([
	enwiki("Euler's_four-square_identity"),

	enwiki("Degen's_eight-square_identity"),
	enwiki("Pfister's_sixteen-square_identity"),


	enwiki('Brahmagupta–Fibonacci_identity'),
	enwiki('Symmetric_polynomial'),
	enwiki('Symmetric_group'),
	inhref('wiki.html?q=Formula/Equation/Diophantus'),
	inhref('wiki.html?q=Formula/Sequence/Sum'),
	'代数多项式，哈尔滨工业大学出版社',
]);